package midpmpc.config;

public class Server {

    public String addr;
    public String port;
    public String name;
    boolean isDef;

    public Server(byte[] spec) {
        super();
        String str = new String(spec);
        if (str.charAt(0) == '*') {
            isDef = true;
            str = str.substring(1);
        }
        int ne = str.indexOf(":");
        int ae = str.indexOf(":", ne+1);
        name = str.substring(0, ne);
        addr = str.substring(ne + 1, ae);
        port = str.substring(ae + 1);
    }

    public Server(String n, String a, String p) {
        super();
        name = n;
        addr = a;
        port = p;
    }

    public String toString() {
        return name+':' +addr + ':' + port;
    }
    public String toAddr(){
        return addr + ':' + port;

    }

}
